/*
 * quickSort.cpp
 *
 *  Created on: Aug 16, 2012
 *      Author: jh238d
 */
#include <iostream>
using namespace std;

void quickSort(int arr[], int l, int r){
	int left  = l, right = r;
	int pivot = arr[l+(r-l)/2];
	while(l<=r){
		while(arr[l]<pivot)
			l++;
		while(arr[r]>pivot)
			r--;
		if(l<=r){
			swap(arr[l],arr[r]);
			l++;
			r--;
		}
	}
	if(left<r)
		quickSort(arr,left,r);
	if(l<right)
		quickSort(arr,l,right);
}

/*int main(){
	int arr[11]={3,1,5,6,4,3,2,8,6,1,10};
	int n=sizeof(arr)/sizeof(int);
	quickSort(arr,0,n-1);
	for(int i=0;i<n;i++)
		cout<<arr[i]<<" ";
	cout<<endl;
	return 0;
}*/



